//
//  PlayerFighter.h
//  airfight
//
//  Created by aaron more on 12-8-24.
//  Copyright (c) 2012年 moonriver. All rights reserved.
//

#ifndef airfight_PlayerFighter_h
#define airfight_PlayerFighter_h


#include "extensions/CCNotificationCenter/CCNotificationCenter.h"
#include "env.h"
#include "EntitySprite.h"
#include "BulletSprite.h"
#include "EnemyBulletSprite.h"
#include "BulletNode.h"

USING_NS_CC;
USING_NS_CC_EXT;

enum player_toDestoryFlag
{
    PLAYER_DESTROY_DIE = 1,
    PLAYER_DESTROY_SUCCESS = 2
};

class PlayerFighterSprite : public EntitySprite
{
    CC_SYNTHESIZE(int,m_pFighterId,FighterId);
    CC_SYNTHESIZE(int,m_pBlood,Blood); //血量
    CC_SYNTHESIZE(int,m_pArmor,Armor); //护甲
    CC_SYNTHESIZE(int,m_pSpeed,Speed); //移动速度
    
    
private:
    CCSpriteBatchNode *batch;
    CCArray *toRedrawBullets;
    
protected:
    CCDictionary *m_pBulletDictionary;
    
public:
    PlayerFighterSprite();
    ~PlayerFighterSprite();
    bool init();
    void onEnter();
    void update(float dt);
    void setBullets(int p_id,BulletNode *node);
    
    void handleContact(ENTITY_TYPE type, CCDictionary *effect);
    void redrawBulletContact(CCInteger* tag);
    void redrawBulletOutbound(CCInteger* tag);
    
    SPRITE_CREATE_FUNC(PlayerFighterSprite);
    
    void touchesBegan(CCSet* touches, CCEvent* event);
    void touchesMoved(CCSet* touches, CCEvent* event);
    void touchesEnded(CCSet* touches, CCEvent* event);
    
public:
    int bullet_baseTag;
    int bullet_idxTag;
    int bouns_BaseTag;
    
private:
    CCPoint m_InitTouch;
    CCPoint m_CurTouch;
    CCPoint m_AimLocation;
    CCPoint m_InitLocation;
    int m_iTouches;
    int m_IFrameIndex; 
};

#endif
